import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    ws:WebSocket,
    globalWs:WebSocket,
    roomId:'',
    chatMsg:[],
    meNickName: '',
    meAvatar: '',
    youNickName: '',
    youAvatar: '',
  },
  mutations: {
    setMeNickName(state, meNickName){
      state.meNickName = meNickName
    },
    setMeAvatar(state, meAvatar){
      state.meAvatar = meAvatar
    },
    setYouNickName(state, youNickName){
      state.youNickName = youNickName
    },
    setYouAvatar(state, youAvatar){
      state.youAvatar = youAvatar
    },
    setWs(state,ws){
      state.ws=ws
    },
    setGlobalWs(state,globalWs){
      state.globalWs=globalWs
    },
    addChatMsg(state,msg){
      state.chatMsg.push(msg)
    },
    setRoomId(state,room_id){
      state.roomId=room_id
    }
  },
  actions: {
  },
  modules: {
  }
})
